home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
7_10.lha
/
7_10
/
p_sleep.c
< prev
next >
Wrap
Text File
|
1993-08-08
|
770b
|
29 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
include <process.h>
include <debug.h> /* DELETE */
/ delay for a given amount of pseudo-time
oid process::sleep(unsigned long t)
if (debug) /*DELETE*/ cerr << "process" << this << "::sleep(" << t << ")\n";
if (debug) /*DELETE*/ cerr << "\tt_curtime == " << t_curtime << "\n";
if (mustrecurse())
sleep(t);
else
{
// remove this from other lists
// and place back on run queue
// ordered by new desired time
wakeup(t);
// save and schedule another process
if (t_thisprocess == this)
if (!contextswitch())
schedule();
if (debug) /*DELETE*/ cerr << "<<<< process" << this << "::sleep(" << t << ")\n";
}